<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRepliesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('replies', function (Blueprint $table) {
            $table->engine = 'innodb';
            $table->increments('id')->unsigned();
            $table->unsignedInteger('article_id')->default(0)->comment('文章id')->index('article_id');
            $table->string('nickname', 25)->default('匿名')->comment('游客回帖名');
            $table->string('email', 100)->default('')->comment('游客邮箱');
            $table->text('content')->comment('游客回帖内容');
            $table->text('admin_content')->comment('管理员回复');
            $table->unsignedInteger('created_at')->default(0);
            $table->unsignedInteger('updated_at')->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('replies');
    }
}
